home *** CD-ROM | disk | FTP | other *** search
- onClipEvent(enterFrame){
- if(_root.ninja._x > this._x && this._name != "dead" && this._name != "enemyRoll")
- {
- this._xscale = - Math.abs(this._xscale);
- _root.enemyLeft = true;
- }
- else if(_root.ninja._x <= this._x && this._name != "dead" && this._name != "enemyRoll")
- {
- this._xscale = Math.abs(this._xscale);
- _root.enemyLeft = false;
- }
- if(_X > _root.ninja._x + 120 && this._name != "dead" && _root.enemyHit != true && this._name != "enemyRoll")
- {
- this.gotoAndStop(1);
- _X = _X - (Math.random() * 5 + 5);
- }
- else if(_X < _root.ninja._x - 120 && this._name != "dead" && _root.enemyHit != true && this._name != "enemyRoll")
- {
- this.gotoAndStop(1);
- _X = _X + (Math.random() * 5 + 5);
- }
- else if(_X <= _root.ninja._x + 70 || _X >= _root.ninja._x - 70)
- {
- if(_root.enemyHit != true && this._currentframe != 3 && this._name != "dead" && this._name != "enemyRoll")
- {
- this.gotoAndStop(2);
- }
- }
- if(this._x < 10)
- {
- this.gotoAndPlay(50);
- }
- else if(this._x > 535)
- {
- this.gotoAndPlay(50);
- }
- }
-